<template>
  <el-form :inline="true" v-model="plantSearch" class="demo-form-inline">
    <el-form-item style="margin-right: 10px;">
      <el-input class="search-input" v-model="plantSearch.search" placeholder="学名/作品名/拉丁学名/作品描述" />
    </el-form-item>
    <el-form-item>
      <el-button class="search-btn" @click="toSearch" type="primary" :icon="Search">检索图片</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">
import { Search } from '@element-plus/icons-vue';
import { ref, reactive } from "vue"
import { useRouter } from 'vue-router';

const router = useRouter()

const plantSearch = reactive({
  search: ''
})

const toSearch = () => {
  if (plantSearch.search !== '') {
    sessionStorage.removeItem('navigation_index')
    router.push({ name: 'Search', params: { search: plantSearch.search } })
  }
}

</script>

<style lang="scss" scoped>
.search-input {
  width: 450px;
  height: 45px;
  line-height: 45px;
  font-size: 18px;
}

.search-btn {
  height: 45px;
  width: 120px;
  line-height: 45px;
  font-size: 18px;
}
</style>